<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>コントロールパネル</title>

    <link href="./assets/styles/default.css" rel="stylesheet" />
	<script src="./assets/scripts/libs/jquery-1.7.1.min.js" type="text/javascript"></script>
	<script src="./assets/scripts/import.js" type="text/javascript"></script>
       		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.form1.csv.value="download";
					document.form1.submit();
					
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.form1.action;
			});
			
			$('#btn_search').click(function(){	
				document.form1.csv.value="";
				document.form1.submit();
			});

			$('#btn_single_c').click(function(){	
				location.href ="{{'Home/Item/insert'|U}}";
			});
		});
	
		function toPage(thepage) {
			document.form1.page.value =  thepage;
			document.form1.csv.value="";
			document.form1.submit();
		}
		

function CopyPath(FilePath,id)
{
	
	
  //  var str=location.toString();
    var Result='{{$result}}';
    var Result_id='{{$result}}_id';
   
    window.opener.document.getElementById(Result).value = FilePath;
    window.opener.document.getElementById(Result_id).value = id;	
	//window.opener.document.fm(Result).value=FilePath;
   window.opener=null;
    window.close();
}

</script>
</head>
<body>
	
 <section id="content">

        	<h3>商品検索</h3>
			<div id="search_form">
				<form name="form1" id="form1" method="get" action="{{'Home/item/searchopen'|U}}">
					<input type="hidden" name="page" />
					<dl>
						<dt>フリーワード</dt>
						<dd>
							<input type="text" name="free_word" value="{{$forms.free_word}}" />
						</dd>
					</dl>
					<dl>
						<dt>状態</dt>
						<dd>
					    {{ foreach from=$goods_status key=kk item=vv name="member" }}
					   		{{assign var="goods_statu" value= goods_statu$kk}}
							<label><input type="checkbox" name="goods_statu{{$kk}}"  {{if $forms[$goods_statu] == $kk }} checked="true" {{/if}} value="{{$kk}}" />{{$vv}}</label>
						{{ /foreach }}
						</dd>
					</dl>
					<dl>
						<dt>更新日時</dt>
						<dd>
							<input type="text" name="data1" class="text_date" value="{{ $forms.data1 }}" /> ～
							<input type="text" name="data2" class="text_date" value="{{ $forms.data2 }}" />
						</dd>
					</dl>
					<dl class="category clear">
						<dt>カテゴリー</dt>
						<dd>
							<p class="btn_blank float-left btn_category" id="id_category">
								<a href="javascript:;">カテゴリ選択</a>
							</p>
							<ul id="search_category" class="float-left">
							</ul>
						</dd>
					</dl>
					<p class="search_submit">
						<button type="submit" class="submit"><span>検索</span></button>
					</p>
				<INPUT type='hidden' name='result' value='{{$result}}'/>
			    <input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
				</form>
			</div>
{{if !$is_showlist }}
			<p class="message">{{if $page.cnt>0}}{{$page.cnt}}件登録されています。{{else}}見つかりませんでした。{{/if}}</p>

			{{$result}}

			<table id="search_result" class="sortable">
				<thead>
					<tr>
						<th>コード</th>
						<th width="64">画像</th>
						<th>商品名</th>
						<th>価格</th>
						
					
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
								{{ foreach from=$data key=k item=v name="member" }}
								<tr>
						            <td>{{$v.goods_id}}</td>
						            <td class="alig-center"><img src="./images/{{$v.goods_image}}" width="64" height="64" /></td>
						            <td>{{$v.goods_name}}</td>
						            <td>{{$v.goods_unitprice}}円</td>
						          <td class="update"><a href="javascript:CopyPath('{{$v.goods_name}}','{{$v.goods_id}}');">插入</a></td>
					             </tr>
								{{ /foreach }}	
				</tbody>
			</table>

			<p class="pageNav">
				{{$pageing}}
			</p>
{{/if}}
        </section>
</body>
</html>